#pragma once

template<typename T>
class singleton
{
private:
    static T* m_singleton;
public:
    static void CreateInstance()
    {
        if(m_singleton == nullptr)
        {
            m_singleton = new T();
        }
    }
    static void DestroyInstance()
    {
        if(m_singleton != nullptr)
        {
            delete m_singleton;
            m_singleton = nullptr;
        }
    }
    static T* Instance()
    {
        return m_singleton;
    }
};

template<typename T>
T* singleton<T>::m_singleton = nullptr;
